#include "stu_add_dialog.h"
#include "ui_stu_add_dialog.h"

stu_add_Dialog::stu_add_Dialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::stu_add_Dialog),
    flag(false),
    student({"","","","",""})
{
    ui->setupUi(this);
    ui->pushButton_OK->setEnabled(false);
    ui->lineEdit_booknum->setText("0");
//    ui->
}

stu_add_Dialog::~stu_add_Dialog()
{
    delete ui;
}

void stu_add_Dialog::on_pushButton_OK_clicked()
{
    flag = true;
//    student.append(ui->lineEdit_number->text());
//    student.append(ui->lineEdit_name->text());
//    student.append(ui->comboBox_mojar->currentText());
//    student.append(ui->comboBox_class->currentText());
//    student.append("0");
    student[0] = ui->lineEdit_number->text();
    student[1] = ui->lineEdit_name->text();
    student[2] = ui->comboBox_mojar->currentText();
    student[3] = ui->comboBox_class->currentText();
    student[4] = "0";
    this->close();

}

void stu_add_Dialog::closeEvent(QCloseEvent *event)
{
    this->close();
}

void stu_add_Dialog::on_lineEdit_number_textChanged(const QString &arg1)
{
    if(!arg1.isEmpty()) ui->pushButton_OK->setEnabled(true);
}

void stu_add_Dialog::on_pushButton_Canle_clicked()
{
    this->close();
}
